﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AgilePlannerDT.Persister.Impl.File
{
    public class FileSystemIDGenerator
    {
        protected long id;

        protected static FileSystemIDGenerator generator;

        protected FileSystemIDGenerator()
        {
            Reset();
        }

        public static FileSystemIDGenerator GetInstance()
        {
            if (generator == null)
            {
                generator = new FileSystemIDGenerator();
                return generator;
            }
            else
            {
                return generator;
            }
        }

        public void Init(long id)
        {
            this.id = id;
        }

        public long GetNextID()
        {
            return this.id++;
        }

        public void Reset()
        {
            this.id = new Random().Next() + 100;
        }

    }
}
